﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BeachRunner.Tileengine
{
    /// <summary>
    /// Ein Ebene
    /// 
    /// Autor: OLD (Mattis Hänel)
    /// </summary>
    public struct Layer
    {
        /// <summary>
        /// Für jedes Tile der Ebene ein short
        /// </summary>
        private short[] data;
        /// <summary>
        /// Die Daten der Ebene
        /// </summary>
        public short[] Data
        {
            get { return data; }
        }

        /// <summary>
        /// Die Breite der Ebene ( in Tiles )
        /// </summary>
        private int width;
        /// <summary>
        /// Die Breite der Ebene ( in Tiles )
        /// </summary>
        public int Width
        {
            get { return width; }
        }

        /// <summary>
        /// Die Höhe der Ebene ( in Tiles )
        /// </summary>
        private int height;
        /// <summary>
        /// Die Höhe der Ebene ( in Tiles )
        /// </summary>
        public int Height
        {
            get { return height; }
        }

        /// <summary>
        /// Kopierkonstruktor
        /// </summary>
        /// <param name="layer">Die zu kopierende Ebene</param>
        public Layer(Layer layer)
        {
            this.width = layer.width;
            this.height = layer.height;
            this.data = (short[])layer.data.Clone();
        }

        /// <summary>
        /// Erstellt eine leere Ebene 
        /// </summary>
        /// <param name="width">Breite der Ebene ( in Tiles )</param>
        /// <param name="height">Höhe der Ebene ( in Tiles )</param>
        public Layer(int width, int height)
        {
            this.width = width;
            this.height = height;
            data = new short[ width * height ];
        }

        /// <summary>
        /// Erstellt eine neue Ebene
        /// </summary>
        /// <param name="width">Breite der Ebene ( in Tiles )</param>
        /// <param name="height">Höhe der Ebene ( in Tiles )</param>
        /// <param name="data">Die für die Ebene zu verwendenden Daten</param>
        public Layer(int width, int height, short[] data)
        {
            this.width = width;
            this.height = height;
            this.data = data;
        }
    }
}
